﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PissingRepositoryMock.cs" company="melcoprog">
//   Copyright (c) melcoprog. All rights reserved.
// </copyright>
// <summary>
//   Defines the PissingRepositoryMock type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace CreatureSheep.CreatureState
{
    using System.Collections.Generic;
    using System.Drawing;
    using System.Drawing.Drawing2D;

    using CreatureSheep.CreatureStates;
    using CreatureSheep.Image;

    using ESheep;

    /// <summary>
    /// The pissing repository mock.
    /// </summary>
    public class PissingRepository : IStateRepository
    {
         /// <summary>
        /// The image.
        /// </summary>
        private readonly Bitmap image;

        /// <summary>
        /// Initializes a new instance of the <see cref="PissingRepository"/> class.
        /// </summary>
        /// <param name="image">
        /// The image.
        /// </param>
        public PissingRepository(Bitmap image)
        {
            this.image = image;
        }

        /// <summary>
        /// The get configuration.
        /// </summary>
        /// <returns>
        /// The <see cref="StateConfiguration"/>.
        /// </returns>
        public StateConfiguration GetConfiguration()
        {
            const int Height = 40;
            const int Width = 40;

            var idleConfiguration = new StateConfiguration
                                        {
                                            Height = Height,
                                            Width = Width,
                                            LeftSprites = new List<KeyValuePair<Bitmap, GraphicsPath>>(),
                                            RightSprites = new List<KeyValuePair<Bitmap, GraphicsPath>>()
                                        };

            var sprites = new SpriteMaker(this.image, Width, Height);

            var sprite1 = sprites.GetSprite(13, 1);
            var path1 = BitmapRegion.CalculateControlGraphicsPath(sprite1);

            idleConfiguration.LeftSprites.Add(new KeyValuePair<Bitmap, GraphicsPath>(sprite1, path1));

            var sprite2 = sprites.GetSprite(7, 7);
            var path2 = BitmapRegion.CalculateControlGraphicsPath(sprite2);

            idleConfiguration.LeftSprites.Add(new KeyValuePair<Bitmap, GraphicsPath>(sprite2, path2));

            var sprite3 = sprites.GetSprite(8, 7);
            var path3 = BitmapRegion.CalculateControlGraphicsPath(sprite3);

            idleConfiguration.LeftSprites.Add(new KeyValuePair<Bitmap, GraphicsPath>(sprite3, path3));

            var sprite4 = sprites.GetSprite(9, 7);
            var path4 = BitmapRegion.CalculateControlGraphicsPath(sprite4);

            idleConfiguration.LeftSprites.Add(new KeyValuePair<Bitmap, GraphicsPath>(sprite4, path4));

            var sprite5 = sprites.GetSprite(10, 7);
            var path5 = BitmapRegion.CalculateControlGraphicsPath(sprite5);

            idleConfiguration.LeftSprites.Add(new KeyValuePair<Bitmap, GraphicsPath>(sprite5, path5));

            return idleConfiguration;
        }
    }
}
